import java.util.Scanner;

public class IfExample2{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);    
		double grade;
		char letterGrade;
		System.out.println("Enter a numeric grade [0 - 100]: ");
		grade = scanner.nextDouble();
		if(grade < 0.0 || grade > 100.0)
		     System.out.println("Error: Invalid grade"); 
		else{
            if(grade >= 85.0)
      		     letterGrade = 'A';
      		else if(grade >= 75.0)
      		     letterGrade = 'B';
      		else if(grade >= 65.0) 
      		     letterGrade = 'C';
      		else if(grade >= 45.0)
      		     letterGrade = 'D';
      		else
      		     letterGrade = 'F';
		
		    System.out.printf("The letter grade is %c", letterGrade);
		}   
	}
}	
	